﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Authentication;
using System.Web;
using System.Web.Security;
using Core;
using Data;
using Model;

namespace Web
{
    public class Commons
    {
        public static Model.sys_user User {
            get {
                //var user = HttpContext.Current.Session["user"] as Model.sys_user;
                //if (user == null) {
                var userId = HttpContext.Current.User.Identity.Name;
                var user = new sys_userService().GetModel(ParamQuery.Instance()
                                                          .AddWhere("user_id", userId));
                //HttpContext.Current.Session["user"] = user;
                //}
                return user;
            }
        }

        public static string UserId {
            get { return HttpContext.Current.User.Identity.Name; }
        }

        public static DateTime ServerDateTime {
            get { return DateTime.Now; }
        }

    }
}